<template>
  <div id="app">
    <!-- <div id="nav">
      <router-link to="/">Home</router-link> |
      <router-link to="/about">About</router-link>
    </div>
    <router-view /> -->
    <!-- 上面注释的代码的意思是在app里加载home 和 about -->

    <h1 @click="handler">这是app入口组件</h1>
    <h1>app。vue被引入 main .js main.js 被引入 index.html</h1>
    <h2>{{ msg }}</h2>
  </div>
</template>
<script>
export default {
  data() {
    return {
      msg: "hello world",
    };
  },
  //data是一个函数，这种省略function的写法 是es6中对象里函数的简写形式
  methods: {
    handler() {
      alert(this.msg);
    },
  },
};
</script>
<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
